package com.bn.commerce.order;

import java.util.Iterator;
import java.util.Properties;
import java.util.Set;

import atg.projects.store.payment.creditcard.StoreCreditCardTools;


public class BNCreditCardTools extends StoreCreditCardTools{

	/**
     * this method used to get Creditcard type
     *
     * @param ccNumber
     * @return
     */
    public String getCreditCardType(String ccNumber) {
        Properties cardPrefixesMap = getCardPrefixesMap();
        String cardType = "";
        Set prefixTypes = cardPrefixesMap.keySet();
        Iterator itr = prefixTypes.iterator();
        while (itr.hasNext()) {
            String str = (String) itr.next();
            if (ccNumber.startsWith(str)) {
                cardType = cardPrefixesMap.getProperty(str);
                if (isLoggingDebug()) {
                    logDebug("creditcard type :" + cardType);
                }
                break;
            }
        }
        return cardType;
    }
}
